Carbon


FSMakeFSSpec

Header: Files.h Carbon status: Supported

Initializes an FSSpec structure to particular values for a file or directory.\

OSErr FSMakeFSSpec (
    SInt16 vRefNum, 
    SInt32 dirID, 
    ConstStr255Param fileName, 
    FSSpec *spec
);
vRefNum

A volume specification. This parameter can contain a volume reference number, a working directory reference number, a drive number, or 0 (to specify the default volume).

dirID

A directory specification. This parameter usually specifies the parent directory ID of the target object. If the directory is sufficiently specified by either the vRefNum or fileName parameter, dirID can be set to 0. If you explicitly specify dirID (that is, if it has any value other than 0), and if vRefNum specifies a working directory reference number, dirID overrides the directory ID included in vRefNum. If the fileName parameter contains an empty string, FSMakeFSSpec creates an FSSpec structure for a directory specified by either the dirID or vRefNum parameter.

fileName

A full or partial pathname. If fileName specifies a full pathname, FSMakeFSSpec ignores both the vRefNum and dirID parameters. A partial pathname might identify only the final target, or it might include one or more parent directory names. If fileName specifies a partial pathname, then vRefNum, dirID, or both must be valid.

spec

A pointer to a file system specification to be filled in by FSMakeFSSpec. The FSMakeFSSpec function fills in the fields of the spec parameter using the information contained in the other three parameters.

function result

A result code.

DISCUSSION

Call FSMakeFSSpec whenever you want to create an FSSpec structure.

If the specified volume is mounted and the specified parent directory exists, but the target file or directory doesn’t exist in that location, FSMakeFSSpec fills in the structure and then returns fnfErr instead of noErr. The structure is valid, but it describes a target that doesn’t exist. You can use the structure for other operations, such as creating a file with the FSpCreate function.

In addition to the result codes that follow, FSMakeFSSpec can return a number of other File Manager error codes. If your application receives any result code other than noErr or fnfErr, all fields of the resulting FSSpec structure are set to 0.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)